package com.gqmk.demo.springcloudfeign.service;

import com.gqmk.demo.springcloudapi.domain.Demo;
import feign.hystrix.FallbackFactory;
import org.springframework.stereotype.Component;

import java.math.BigDecimal;
import java.util.Date;

@Component
public class DemoHystrixServiceFallbackFactory implements FallbackFactory<DemoFeignService> {
    @Override
    public DemoFeignService create(Throwable throwable) {
        return () -> new Demo().setId(0).setName("error").setMoney(BigDecimal.ZERO).setCreateDate(new Date()).setIsEnable(false);
    }
}
